/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bookstore.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
/**
 *
 * @author cjx
 */
public class DownAction extends ActionSupport
{
    private String inputpath;
    public String getInputpath(){return inputpath;}
    public void setInputpath(String inputpath){this.inputpath=inputpath;}
    private String contentType;
    public String getContentType(){return contentType;}
    public void setContentType(String contentType){this.contentType=contentType;}
    public String filename;
    /*
    public void setFilename(String filename){this.filename=filename;}
    public String getFilename(){return filename;}*/
    @Override
    public String execute() throws Exception 
            {
                inputpath="/upfiles/1234567.jpg";
                contentType="image/jpeg";
                String ofilename="下载的文件.jpg";
                filename=java.net.URLEncoder.encode(ofilename,"UTF-8");
                return SUCCESS;
            }
    public java.io.InputStream getInputStream()
    {
        return ServletActionContext.getServletContext().getResourceAsStream(inputpath);
    }
}
